Home / Data table / List

Data table ‐ List


Get a list of all data tables of the current workspace

Endpoint

GET /api/datatable/list

Headers

see Using authentication token

Response

  • Invalid response: See Invalid response in Standard response rules
  • Valid response
    Valid response contains fields: valid set to true, data with an array of objects, each having an info about individual data table, and field pagination which contains info about number of rows and pagination.
    Each data table has following info :
    • name(string), name of the data table
    • type("api"|"default") can be either default, or api. If table is of type default it means only read operations can be made on it (searching within it and getting its' info), tables of type api can have their rows added, modified and deleted via API methods
    • primary_key(boolean) which of the columns of the table is a primary key (used to uniquely identify row).
    • columns(Object[]) list of columns in the table structure.
    Each column has following info about itself:
    • primary (boolean) is the column primary or not
    • type ("integer"|"float"|"string"|"datetime"|"email") - type of the data in the column
    • mandatory (boolean) - is the column mandatory (if data table is of default type this will be always false)

        {
            "valid": true,
            "data": [
                {
                    "name": "some table",
                    "type": "api",
                    "primary_key": "some field",
                    "columns": {
                        "some field": {
                            "primary": true,
                            "type": "integer",
                            "mandatory": false
                        },
                        "some other field": {
                            "primary": false,
                            "type": "integer",
                            "mandatory": false
                        } 
                    }
                }, 
                {
                    "name": "some other table",
                    "type": "api",
                    "primary_key": "id",
                    "columns": {
                            "id": {
                            "primary": true,
                            "type": "integer",
                            "mandatory": false
                        },
                        "client_id": {
                            "primary": false,
                            "type": "integer",
                            "mandatory": false
                        } 
                    }
                } 
            ],
            "pagination": {
                "is_next_page": false,
                "rows_per_page": 2,
                "total_rows": 2,
                "total_pages": 1
            } 
        }

Example code:

<?php

require_once 'RestOpen.php';

$username = 'my_username';
$password = 'my_password';
$workspaceId = 999;

$rest = new RestOpen($username, $password, $workspaceId);
$result = $rest->getDataTableList();

var_dump($result);